﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.IO;

namespace Save_Editor.Classes
{
    public class AccessorMaker
    {
        public static void CreateAccessors(Type T)
        {
            StreamWriter sw = new StreamWriter(File.Create(T.Name + ".txt"));

            FieldInfo[] fInf = T.GetFields();
            foreach (FieldInfo F in fInf)
            {
                sw.WriteLine(string.Format("public {0} attr_{1} {2} get {2} return {1}; {3} set {2} Changed(\"attr_{1}\"); {1} = value; {3} {3}", F.FieldType.Name, F.Name, "{", "}"));
            }
            sw.Close();
        }
    }
}
